package com.nav.tictactoe;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class MoveListener implements Runnable {
	GameActivity act;
	public MoveListener(GameActivity act) {
		this.act = act;
	}
	public void run() {
		try {
			BufferedReader rdr = new BufferedReader(new InputStreamReader(SharedData.opponent.getInputStream()));
			String data = rdr.readLine();
			if(data.startsWith("M")) {
				int r = data.charAt(1) - '0', c = data.charAt(2) - '0';
				act.select(r, c);
			}
		} catch(Exception e) {
			// TODO show error message
		}
	}
}
